package netTracker;

import java.io.Serializable;

/**
 * A song contains a sequence of patterns and other information about the song.
 */
public class Song implements Serializable{

	private static final long serialVersionUID = 1L;

	/** A sequence that represents an order of patterns. */
	Sequence sequence;
	/** Represents the name of the song. */
	String songName;
	/** The tempo (in BPM) of the song. */
	double tempo;
	/** The sample bank of the song. */
	SampleBank sampleBank;
	
	transient NetTracker netTracker;

	/** Creates an empty song with default values. 
	 * @param tracks the number of tracks.
	 * @param cells the number of cells in each track.*/
	public Song (int tracks, int cells, NetTracker netTracker){
		this.netTracker=netTracker;
		tempo = 90;	//	Default tempo
		songName = "";
		// sampleBank = new SampleBank();
		sequence = new Sequence(tracks, cells, this);
	}
	
	/** @return the sequence within the song. */
	public Sequence getSequence(){
		return sequence;
	}

	/** @return the number of tracks. */
	public int getNumTracks() {
		return sequence.getNumTracks();
	}
	
	/** @return the number of cells. */
	public int getNumCells() {
		return sequence.getNumCells();
	}
	
	/** Returns a specified pattern.
	 * @param index the index value of the pattern to return.
	 * @return
	 */
	public Pattern getPattern(int index){
		return sequence.getPatterns().get(index);
	}

	public double getTempo() {
		return tempo;
	}
	
	/**
	 * Gets the tracks from a given pattern.
	 * @return the tracks from the given pattern
	 */
	public Track[] getTracks(int patternNum){
		return getPattern(patternNum).getTracks();
	}
	
	public NetTracker getNetTracker() {
		return netTracker;
	}
}
